package com.example.myapplication;

import android.content.Intent;
//import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication.R;

public class ConstellationActivity extends AppCompatActivity {
    //第一步：定义对象
    Button btn_search;
    EditText edit_inputname;
    DatePicker date_birth;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_constellation);
        //第二步：绑定控件
        btn_search=findViewById(R.id.button_search);
        edit_inputname=findViewById(R.id.edit_inputname);
        date_birth=findViewById(R.id.datePicker_birth);

        //第三步：按钮单击事件
        btn_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent( ConstellationActivity.this,ConstellationActivity2.class   );
                intent.putExtra("name",edit_inputname.getText().toString());
                intent.putExtra("year",date_birth.getYear());
                intent.putExtra("yue",date_birth.getMonth());
                intent.putExtra("ri",date_birth.getDayOfMonth());
                startActivity(intent);
            }
        });
    }
}
